home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / pcl / docs.lha / latexinfo / elisp / latexnfo-mde.el < prev    next >
Encoding:
Text File  |  1991-11-27  |  21.8 KB  |  584 lines

  1. ;;;; latexnfo-mode.el
  2.  
  3. ;;; Major mode for editing Latexinfo files.
  4.  
  5. ;;; Robert J. Chassell          
  6. ;;; Converted to LaTeXinfo by Mike Clarkson
  7. ;;; Please send bug reports to:  mike@apl.ists.ca
  8.  
  9. ;; Copyright (C) 1985, 1988, 1989, 1990, 1991 Free Software Foundation, Inc.
  10. ;; Copyleft  (C) 1988, 1989, 1990, 1991 Michael E. Clarkson
  11.  
  12.  
  13. ;;; This file is not a part of GNU Emacs.
  14.  
  15. ;; GNU Emacs is free software; you can redistribute it and/or modify
  16. ;; it under the terms of the GNU General Public License as published by
  17. ;; the Free Software Foundation; either version 1, or (at your option)
  18. ;; any later version.
  19.  
  20. ;; GNU Emacs is distributed in the hope that it will be useful,
  21. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  23. ;; GNU General Public License for more details.
  24.  
  25. ;; You should have received a copy of the GNU General Public License
  26. ;; along with GNU Emacs; see the file COPYING.  If not, write to
  27. ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  28.  
  29.  
  30. ;;; Autoloads
  31.  
  32. (autoload 'latexinfo-format-region
  33.           "latexinfo"
  34.   "Convert the current region of the Latexinfo file to Info format.
  35. This lets you see what that part of the file will look like in Info.
  36. The command is bound to \\[latexinfo-format-region].  The text that is
  37. converted to Info is stored in a temporary buffer."
  38.           t nil)
  39.  
  40. (autoload 'latexinfo-format-buffer
  41.           "latexinfo"
  42.   "Process the current buffer as latexinfo code, into an Info file.
  43. The Info file output is generated in a buffer visiting the Info file
  44. names specified in the \\setfilename command.
  45.  
  46. Non-nil argument (prefix, if interactive) means don't make tag table
  47. and don't split the file if large.  You can use Info-tagify and
  48. Info-split to do these manually."
  49.           t nil)
  50.  
  51. (autoload 'kill-compilation
  52.           "compile"
  53.   "Kill the process made by the \\[compile] command."
  54.           t nil)
  55.  
  56. (autoload 'latexinfo-latex-region
  57.           "latexnfo-tex"
  58.   "Run latex on the current region. 
  59.  
  60. A temporary file is written in the default directory, and LaTeX is run
  61. in that directory.  The first line of the file is copied to the
  62. temporary file; and if the buffer has a header, it is written to the
  63. temporary file before the region itself.  The buffer's header is all
  64. lines between the strings defined by latexinfo-start-of-header and
  65. latexinfo-end-of-header inclusive.  The header must start in the first 100
  66. lines.  The value of latexinfo-latex-trailer is appended to the temporary file
  67. after the region."
  68.           t nil)
  69.  
  70. (autoload 'latexinfo-latex-buffer
  71.           "latexnfo-tex"
  72.   "Run LaTeX on current buffer.
  73. After running LaTeX the first time, you may have to run \\[latexinfo-latexindex]
  74. and then \\[latexinfo-latex-buffer] again."
  75.           t nil)
  76.  
  77. (autoload 'latexinfo-kill-latex-job
  78.           "latexnfo-tex"
  79.   "Kill the currently running LaTeX job."
  80.           t nil)
  81.  
  82. (autoload 'latexinfo-recenter-latex-output-buffer
  83.           "latexnfo-tex"
  84.   "Redisplay buffer of LaTeX job output so that most recent output can be seen.
  85. The last line of the buffer is displayed on
  86. line LINE of the window, or centered if LINE is nil."
  87.           t nil)
  88.  
  89. (autoload 'latexinfo-delete-from-latex-print-queue
  90.           "latexnfo-tex"
  91.   "Delete job from the line printer spooling queue.
  92. You are prompted for the job number (shown by a previous
  93. \\[latexinfo-show-latex-print-queue] command."
  94.           t nil)
  95.  
  96. (autoload 'latexinfo-show-latex-print-queue
  97.           "latexnfo-tex"
  98.   "Show the print queue that \\[latexinfo-latex-print] put your job on.
  99. Runs the shell command defined by latexinfo-show-latex-queue-command."
  100.           t nil)
  101.  
  102. (autoload 'latexinfo-latex-print
  103.           "latexnfo-tex"
  104.   "Print .dvi file made by \\[latexinfo-latex-region] or \\[latexinfo-latex-buffer].
  105. Runs the shell command defined by latexinfo-latex-dvi-print-command."
  106.           t nil)
  107.  
  108. (autoload 'latexinfo-latexindex
  109.           "latexnfo-tex"
  110.   "Run latexindex on unsorted index files.
  111. The index files are made by \\[latexinfo-latex-region] or \\[latexinfo-latex-buffer].
  112. Runs the shell command defined by latexinfo-latexindex-command."
  113.           t nil)
  114.  
  115. (autoload 'latexinfo-make-menu
  116.           "latexnfo-upd"
  117.   "Without any prefix argument, make or update a menu.
  118. Make the menu for the section enclosing the node found following point.
  119.  
  120. Non-nil argument (prefix, if interactive) means make or update menus
  121. for nodes within or part of the marked region.
  122.  
  123. Whenever a menu exists, and is being updated, the descriptions that
  124. are associated with node names in the pre-existing menu are
  125. incorporated into the new menu.  Otherwise, the nodes' section titles
  126. are inserted as descriptions."
  127.           t nil)
  128.  
  129. (autoload 'latexinfo-update-node
  130.           "latexnfo-upd"
  131.   "Without any prefix argument, update the node in which point is located.
  132. Non-nil argument (prefix, if interactive) means update the nodes in the
  133. marked region.
  134.  
  135. The functions for creating or updating nodes and menus, and their
  136. keybindings, are:
  137.  
  138.     latexinfo-update-node (&optional region-p)    \\[latexinfo-update-node]
  139.     latexinfo-every-node-update ()                \\[latexinfo-every-node-update]
  140.     latexinfo-sequential-node-update (&optional region-p)
  141.  
  142.     latexinfo-make-menu (&optional region-p)      \\[latexinfo-make-menu]
  143.     latexinfo-all-menus-update ()                 \\[latexinfo-all-menus-update]
  144.     latexinfo-master-menu ()
  145.  
  146.     latexinfo-indent-menu-description (column &optional region-p)
  147.  
  148. The `latexinfo-column-for-description' variable specifies the column to
  149. which menu descriptions are indented. Its default value is 24."
  150.           t nil)
  151.  
  152. (autoload 'latexinfo-every-node-update
  153.           "latexnfo-upd"
  154.   "Update every node in a Latexinfo file."
  155.           t nil)
  156.  
  157. (autoload 'latexinfo-all-menus-update
  158.           "latexnfo-upd"
  159.   "Update every regular menu in a Latexinfo file.
  160. Remove pre-existing master menu, if there is one.
  161.  
  162. If called with a non-nil argument, this function first updates all the
  163. nodes in the buffer before updating the menus."
  164.           t nil)
  165.  
  166. (autoload 'latexinfo-master-menu
  167.           "latexnfo-upd"
  168.   "Make a master menu for a whole Latexinfo file.
  169. Non-nil argument (prefix, if interactive) means first update all
  170. existing nodes and menus.  Remove pre-existing master menu, if there is one.
  171.  
  172. This function creates a master menu that follows the top node.  The
  173. master menu includes every entry from all the other menus.  It
  174. replaces any existing ordinary menu that follows the top node.
  175.  
  176. If called with a non-nil argument, this function first updates all the
  177. menus in the buffer (incorporating descriptions from pre-existing
  178. menus) before it constructs the master menu.
  179.  
  180. The function removes the detailed part of an already existing master
  181. menu.  This action depends on the pre-exisitng master menu using the
  182. standard `latexinfo-master-menu-header'.
  183.  
  184. The master menu has the following format, which is adapted from the
  185. recommendation in the Latexinfo Manual:
  186.  
  187.    * The first part contains the major nodes in the Latexinfo file: the
  188.      nodes for the chapters, chapter-like sections, and the major
  189.      appendices.  This includes the indices, so long as they are in
  190.      chapter-like sections, such as chapter* sections.
  191.  
  192.    * The second and subsequent parts contain a listing of the other,
  193.      lower level menus, in order.  This way, an inquirer can go
  194.      directly to a particular node if he or she is searching for
  195.      specific information.
  196.  
  197. Each of the menus in the detailed node listing is introduced by the
  198. title of the section containing the menu."
  199.           t nil)
  200.  
  201. (autoload 'latexinfo-indent-menu-description
  202.           "latexnfo-upd"
  203.   "Indent every description in menu following point to COLUMN.  
  204. Non-nil argument (prefix, if interactive) means indent every
  205. description in every menu in the region.  Does not indent second and
  206. subsequent lines of a multi-line description."
  207.           t nil)
  208.  
  209. (autoload 'latexinfo-sequential-node-update
  210.           "latexnfo-upd"
  211.   "Update one node (or many) in a Latexinfo file with sequential pointers.
  212.  
  213. This function causes the `Next' or `Previous' pointer to point to the
  214. immediately preceding or following node, even if it is at a higher or
  215. lower hierarchical level in the document.  Continually pressing `n' or
  216. `p' takes you straight through the file.
  217.  
  218. Without any prefix argument, update the node in which point is located.
  219. Non-nil argument (prefix, if interactive) means update the nodes in the
  220. marked region.
  221.  
  222. This command makes it awkward to navigate among sections and
  223. subsections; it should be used only for those documents that are meant
  224. to be read like a novel rather than a reference, and for which the
  225. Info `g*' command is inadequate."
  226.           t nil)
  227.  
  228. (autoload 'latexinfo-insert-node-lines
  229.           "latexnfo-upd"
  230.   "Insert missing `\\node' lines in region of Latexinfo file.
  231. Non-nil argument (prefix, if interactive) means also to insert the
  232. section titles as node names; and also to insert the section titles as
  233. node names in pre-existing \\node lines that lack names."
  234.           t nil)
  235.  
  236. (autoload 'latexinfo-multiple-files-update
  237.           "latexnfo-upd"
  238.   "Update first node pointers in each file included in OUTER-FILE;
  239. create or update main menu in the outer file that refers to such nodes. 
  240. This does not create or update menus or pointers within the included files.
  241.  
  242. With optional MAKE-MASTER-MENU argument (prefix arg, if interactive),
  243. insert a master menu in OUTER-FILE.  This does not create or update
  244. menus or pointers within the included files.
  245.  
  246. With optional UPDATE-EVERYTHING argument (numeric prefix arg, if
  247. interactive), update all the menus and all the `Next', `Previous', and
  248. `Up' pointers of all the files included in OUTER-FILE before inserting
  249. a master menu in OUTER-FILE.
  250.  
  251. The command also updates the `Top' level node pointers of OUTER-FILE.
  252.  
  253. Notes: 
  254.  
  255.   * this command does NOT save any files--you must save the
  256.     outer file and any modified, included files.
  257.  
  258.   * except for the `Top' node, this command does NOT handle any
  259.     pre-existing nodes in the outer file; hence, indices must be
  260.     enclosed in an included file.
  261.  
  262. Requirements:
  263.  
  264.   * each of the included files must contain exactly one highest
  265.     hierarchical level node, 
  266.   * this highest node must be the first node in the included file,
  267.   * each highest hierarchical level node must be of the same type.
  268.  
  269. Thus, normally, each included file contains one, and only one,
  270. chapter."
  271.           t nil)
  272.  
  273.  
  274. ;;; Syntax table
  275.  
  276. (defvar latexinfo-mode-syntax-table nil)
  277.  
  278. (if latexinfo-mode-syntax-table
  279.     nil
  280.   (setq latexinfo-mode-syntax-table (make-syntax-table))
  281.   (modify-syntax-entry ?\" " " latexinfo-mode-syntax-table)
  282.   (modify-syntax-entry ?@ "w" latexinfo-mode-syntax-table)
  283.   (modify-syntax-entry ?\\ "\\" latexinfo-mode-syntax-table)
  284.   (modify-syntax-entry ?\^q "\\" latexinfo-mode-syntax-table)
  285.   (modify-syntax-entry ?\[ "(]" latexinfo-mode-syntax-table)
  286.   (modify-syntax-entry ?\] ")[" latexinfo-mode-syntax-table)
  287.   (modify-syntax-entry ?{ "(}" latexinfo-mode-syntax-table)
  288.   (modify-syntax-entry ?} "){" latexinfo-mode-syntax-table)
  289.   (modify-syntax-entry ?$ "w" latexinfo-mode-syntax-table)
  290.   (modify-syntax-entry ?\' "w" latexinfo-mode-syntax-table))
  291.  
  292.  
  293. ;;; Keybindings
  294. (defvar latexinfo-mode-map nil)
  295.  
  296. ;;; Keys common both to Latexinfo mode and to LaTeX shell.
  297.  
  298. (defun latexinfo-define-common-keys (keymap)
  299.   "Define the keys both in Latexinfo mode and in the latexinfo-latex-shell."
  300.   (define-key keymap "\C-c\C-t\C-k"    'latexinfo-kill-latex-job)
  301.   (define-key keymap "\C-c\C-t\C-x"    'latexinfo-quit-latex-job)
  302.   (define-key keymap "\C-c\C-t\C-l"    'latexinfo-recenter-latex-output-buffer)
  303.   (define-key keymap "\C-c\C-t\C-d"    'latexinfo-delete-from-latex-print-queue)
  304.   (define-key keymap "\C-c\C-t\C-q"    'latexinfo-show-latex-print-queue)
  305.   (define-key keymap "\C-c\C-t\C-p"    'latexinfo-latex-print)
  306.   (define-key keymap "\C-c\C-t\C-i"    'latexinfo-latexindex)
  307.  
  308.   (define-key keymap "\C-c\C-t\C-r"    'latexinfo-latex-region)
  309.   (define-key keymap "\C-c\C-t\C-b"    'latexinfo-latex-buffer))
  310.  
  311. ;; Mode documentation displays commands in reverse order 
  312. ;; from how they are listed in the latexinfo-mode-map.
  313.  
  314. (if latexinfo-mode-map
  315.     nil
  316.   (setq latexinfo-mode-map (make-sparse-keymap))
  317.  
  318.   ;; bindings for `latexnfo-tex.el'
  319.   (latexinfo-define-common-keys latexinfo-mode-map)
  320.  
  321.   ;; bindings for `latexinfmt.el'
  322.   (define-key latexinfo-mode-map "\C-c\C-e\C-r"    'latexinfo-format-region)
  323.   (define-key latexinfo-mode-map "\C-c\C-e\C-b"    'latexinfo-format-buffer)
  324.  
  325.   ;; bindings for updating nodes and menus
  326.  
  327.   (define-key latexinfo-mode-map "\C-c\C-um"   'latexinfo-master-menu)
  328.  
  329.   (define-key latexinfo-mode-map "\C-c\C-u\C-m"   'latexinfo-make-menu)
  330.   (define-key latexinfo-mode-map "\C-c\C-u\C-n"   'latexinfo-update-node)
  331.   (define-key latexinfo-mode-map "\C-c\C-u\C-e"   'latexinfo-every-node-update)
  332.   (define-key latexinfo-mode-map "\C-c\C-u\C-a"   'latexinfo-all-menus-update)
  333.   (define-key latexinfo-mode-map "\C-c\C-u\C-i"      'latexinfo-insert-node-lines)
  334.   (define-key latexinfo-mode-map "\C-c\C-u\C-f"      'latexinfo-multiple-files-update)
  335.   (define-key latexinfo-mode-map "\C-c\C-u\C-d"      'latexinfo-indent-menu-description)
  336.   (define-key latexinfo-mode-map "\C-c\C-u\C-s"   'latexinfo-sequential-node-update)
  337.   (define-key latexinfo-mode-map "\C-c\C-s"     'latexinfo-show-structure)
  338.  
  339.   (define-key latexinfo-mode-map "\C-c\C-c}"    'up-list)
  340.   (define-key latexinfo-mode-map "\C-c\C-c{"    'latexinfo-insert-braces)
  341.  
  342.   ;; bindings for inserting strings
  343.  
  344.   (define-key latexinfo-mode-map "\C-c\C-cv"    'latexinfo-insert-var)
  345.   (define-key latexinfo-mode-map "\C-c\C-cs"    'latexinfo-insert-samp)
  346.   (define-key latexinfo-mode-map "\C-c\C-co"    'latexinfo-insert-noindent)
  347.   (define-key latexinfo-mode-map "\C-c\C-cn"    'latexinfo-insert-node)
  348.   (define-key latexinfo-mode-map "\C-c\C-ck"    'latexinfo-insert-kbd)
  349.   (define-key latexinfo-mode-map "\C-c\C-ci"    'latexinfo-insert-item)
  350.   (define-key latexinfo-mode-map "\C-c\C-cx"    'latexinfo-insert-example)
  351.   (define-key latexinfo-mode-map "\C-c\C-ce"    'latexinfo-insert-end)
  352.   (define-key latexinfo-mode-map "\C-c\C-cd"    'latexinfo-insert-dfn)
  353.   (define-key latexinfo-mode-map "\C-c\C-cc"    'latexinfo-insert-code))
  354.  
  355.  
  356. ;;; Latexinfo mode
  357.  
  358. ;; also defined in latexnfo-upd.el
  359. (defvar latexinfo-chapter-level-regexp
  360.   "chapter\\|chapter\\*\\|unnumbered"
  361.   "*Regexp matching chapter-level headings (but not the top node).")
  362.  
  363. (defun latexinfo-mode ()
  364.   "Major mode for editing Latexinfo files.
  365.  
  366.   It has these extra commands:
  367. \\{latexinfo-mode-map}
  368.  
  369.   These are files that are used as input for LaTeX to make printed manuals
  370. and also to be turned into Info files by \\[latexinfo-format-buffer].
  371. These files are written in a version of LaTeX input format.
  372.  
  373.   Editing commands are like text-mode except that the syntax table is
  374. set up so expression commands skip Latexinfo bracket groups.  To see
  375. what the Info version of a region of the Latexinfo file will look like,
  376. use \\[latexinfo-format-region].  This command runs Info on the current region
  377. of the Latexinfo file and formats it properly.
  378.  
  379.   You can show the structure of a Latexinfo file with \\[latexinfo-show-structure].
  380. This command shows the structure of a Latexinfo file by listing the
  381. lines with the commands for \\chapter, \\section, and the like.
  382. These lines are displayed in another window called the *Occur* window.
  383. In that window, you can position the cursor over one of the lines and
  384. use \\[occur-mode-goto-occurrence], to jump to the corresponding spot
  385. in the Latexinfo file.
  386.  
  387.   In addition, Latexinfo mode provides commands that insert various
  388. frequently used commands into the buffer.  You can use these
  389. commands to save keystrokes.  And you can insert balanced braces with
  390. \\[latexinfo-insert-braces] and later use the command \\[up-list] to
  391. move forward past the closing brace.
  392.  
  393. Also, Latexinfo mode provides functions for automatically creating or
  394. updating menus and node pointers.  These functions
  395.  
  396.   * insert the `Next', `Previous' and `Up' pointers of a node,
  397.   * insert or update the menu for a section, and
  398.   * create a master menu for a Latexinfo source file.
  399.  
  400. Here are the functions:
  401.  
  402.     latexinfo-update-node                \\[latexinfo-update-node]
  403.     latexinfo-every-node-update          \\[latexinfo-every-node-update]
  404.     latexinfo-sequential-node-update 
  405.  
  406.     latexinfo-make-menu                  \\[latexinfo-make-menu]
  407.     latexinfo-all-menus-update           \\[latexinfo-all-menus-update]
  408.     latexinfo-master-menu
  409.  
  410.     latexinfo-indent-menu-description (column &optional region-p)
  411.  
  412. The `latexinfo-column-for-description' variable specifies the column to
  413. which menu descriptions are indented. 
  414.  
  415. Passed an argument (a prefix argument, if interactive), the
  416. `latexinfo-update-node' and `latexinfo-make-menu' functions do their jobs
  417. in the region.
  418.  
  419. To use the updating commands, you must structure your Latexinfo file
  420. hierarchically, such that each `\\node' line, with the exception of the
  421. Top node, is accompanied by some kind of section line, such as an
  422. `\\chapter' or `\\section' line.
  423.  
  424. If the file has a `top' node, it must be called `top' or `Top' and
  425. be the first node in the file.
  426.  
  427. Entering Latexinfo mode calls the value of text-mode-hook, and then the
  428. value of latexinfo-mode-hook."
  429.   (interactive)
  430.   (text-mode)
  431.   (setq mode-name "Latexinfo")
  432.   (setq major-mode 'latexinfo-mode)
  433.   (use-local-map latexinfo-mode-map)
  434.   (set-syntax-table latexinfo-mode-syntax-table)
  435.   (make-local-variable 'page-delimiter)
  436.   (setq page-delimiter 
  437.         (concat 
  438.          "^\\\\node [ \t]*[Tt]op\\\\|^\\\\\\(" 
  439.          latexinfo-chapter-level-regexp 
  440.          "\\)"))
  441.   (make-local-variable 'require-final-newline)
  442.   (setq require-final-newline t)
  443.   (make-local-variable 'indent-tabs-mode)
  444.   (setq indent-tabs-mode nil)
  445.   (make-local-variable 'paragraph-separate)
  446.   (setq paragraph-separate (concat "^\b\\|^\\\\[a-zA-Z{}]*[ \n]\\|" paragraph-separate))
  447.   (make-local-variable 'paragraph-start)
  448.   (setq paragraph-start (concat "^\b\\|^\\\\[a-zA-Z{}]*[ \n]\\|" paragraph-start))
  449.   (make-local-variable 'fill-column)
  450.   (setq fill-column 72)
  451.   (make-local-variable 'comment-start)
  452.   (setq comment-start "\\c ")
  453.   (make-local-variable 'comment-start-skip)
  454.   (setq comment-start-skip "\\\\c +")
  455.   (make-local-variable 'words-include-escapes)
  456.   (setq words-include-escapes t)
  457.   (make-local-variable 'latexinfo-start-of-header)
  458.   (setq latexinfo-start-of-header "\\documentstyle")
  459.   (make-local-variable 'latexinfo-end-of-header)
  460.   (setq latexinfo-end-of-header "\\setfilename")
  461.   (run-hooks 'text-mode-hook 'latexinfo-mode-hook))
  462.  
  463.  
  464. ;;; Define start and end of header expressions 
  465.  
  466. ;; The start-of-header and end-of-header expressions are defined here
  467. ;; since they used by both by `latexinfmt.el' and by `latexnfo-tex.el',
  468. ;; only one of which is likely to be loaded at one time.
  469.  
  470. (defvar latexinfo-start-of-header "\\documentstyle"
  471.   "String to mark start of header for latexinfo-latex-region.")
  472.  
  473. (defvar latexinfo-end-of-header "\\begin{document}"
  474.   "String to mark end of header for latexinfo-latex-region.")
  475.  
  476.  
  477. ;;; Insert string commands
  478.  
  479. (defun latexinfo-insert-var ()
  480.   "Insert the string \\var{} in a latexinfo buffer."
  481.   (interactive)
  482.   (insert "\\var{}")
  483.   (backward-char))
  484.  
  485. (defun latexinfo-insert-samp ()
  486.   "Insert the string \\samp{} in a latexinfo buffer."
  487.   (interactive)
  488.   (insert "\\samp{}")
  489.   (backward-char))
  490.  
  491. (defun latexinfo-insert-noindent ()
  492.   "Insert the string \\noindent in a latexinfo buffer."
  493.   (interactive)
  494.   (insert "\\noindent\n"))
  495.  
  496. (defun latexinfo-insert-node ()
  497.   "Insert the string \\node in a latexinfo buffer, 
  498. along with a comment indicating the arguments to \\node."
  499.   (interactive)
  500.   (insert "\\node     \n\\comment  node-name,  next,  previous,  up")
  501.   (forward-line -1)
  502.   (forward-char 6))
  503.  
  504. (defun latexinfo-insert-kbd ()
  505.   "Insert the string \\kbd in a latexinfo buffer."
  506.   (interactive)
  507.   (insert "\\kbd{}")
  508.   (backward-char))
  509.  
  510. (defun latexinfo-insert-item ()
  511.   "Insert the string \\item in a latexinfo buffer."
  512.   (interactive)
  513.   (insert "\\item")
  514.   (newline))
  515.  
  516. (defun latexinfo-insert-example ()
  517.   "Insert the string \\begin{example} in a latexinfo buffer."
  518.   (interactive)
  519.   (insert "\\begin{example}\n\\begin{example}\n")
  520.   (forward-line -2))
  521.  
  522. (defun latexinfo-insert-end ()
  523.   "Insert the string `\\end{}' in a latexinfo buffer."
  524.   (interactive)
  525.   (insert "\\end{}"))
  526.  
  527. (defun latexinfo-insert-dfn ()
  528.   "Insert the string \\dfn{} in a latexinfo buffer."
  529.   (interactive)
  530.   (insert "\\dfn{}")
  531.   (backward-char))
  532.  
  533. (defun latexinfo-insert-code ()
  534.   "Insert the string \\code{} in a latexinfo buffer."
  535.   (interactive)
  536.   (insert "\\code{}")
  537.   (backward-char))
  538.  
  539. (defun latexinfo-insert-braces ()
  540.   "Make a pair of braces and be poised to type inside of them.
  541. Use \\[up-list] to move forward out of the braces."
  542.   (interactive)
  543.   (insert "{}")
  544.   (backward-char))
  545.  
  546.  
  547. ;;; Latexinfo file structure
  548.  
  549. ; The following is defined in `latexnfo-upd.el'
  550. ; (defvar latexinfo-section-types-regexp
  551. ;   "^\\\\\\(chapter\\|sect\\|sub\\|unnum\\)"
  552. ;   "Regexp matching chapter, section, other headings (but not the top node).")
  553.  
  554. (defun latexinfo-show-structure (&optional nodes-too) 
  555.   "Show the structure of a Latexinfo file.
  556. List the lines in the file that begin with the commands for
  557. \\chapter, \\section, and the like.
  558.  
  559. With optional argument (prefix if interactive), list both the lines
  560. with commands for \\chapter, \\section, and the like, and list
  561. \\node lines.
  562.  
  563. Lines with structuring commands beginning in them are displayed in
  564. another window called the *Occur* window.  In that window, you can
  565. position the cursor over one of the lines and use
  566. \\[occur-mode-goto-occurrence], 
  567. to jump to the corresponding spot in the Latexinfo file."
  568.  
  569.   (interactive "P")
  570.   (if (not (fboundp 'latexinfo-make-menu)) (load "latexnfo-upd"))
  571.   (save-excursion 
  572.     (goto-char (point-min))
  573.     (if nodes-too
  574.         (occur (concat "\\(^\\\\node\\)\\|" latexinfo-section-types-regexp))
  575.       (occur latexinfo-section-types-regexp)))
  576.   (pop-to-buffer "*Occur*")
  577.   (goto-char (point-min))
  578.   (flush-lines "-----"))
  579.  
  580.  
  581. ;;; Place provide at end of file.
  582. (provide 'latexnfo-mde)
  583. ;;;;;;;;;;;;;;;; end latexinfo.el ;;;;;;;;;;;;;;;;
  584.